#include <stdio.h>
#include <string.h>

int  shu[100003];
int site[100003];
int n;

main()
{
	int i;
	while (1)
	{
		scanf("%d", &n);
		if (n==0) break;
		memset(shu,0,sizeof(shu));
		memset(site,0,sizeof(site));
		for (i=1;i<=n;i++)
		{
			scanf("%d", &shu[i]);
			site[shu[i]]=i;
		}
		for (i=1;i<=n;i++)
		{
			if (shu[i]!=site[i]) 
				break;
		}
		if (i==n+1) printf("ambiguous\n");
		else printf("not ambiguous\n");
	}
	return 0;
}
